﻿@{
    Layout = null;
}

<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8">
    <link rel="shortcut icon" type="image/ico" href="/favicon.ico" />
    <link rel="bookmark" type="image/ico" href="/favicon.ico" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <link href="/Content/layui/css/layui.css" rel="stylesheet" />
    <link href="/Content/select2/css/select2.css" rel="stylesheet" />
    <link href="/Content/framework/css/console.css" rel="stylesheet" />
    <link href="/Content/framework/css/animate.css" rel="stylesheet" />
    <link href="/Content/font-awesome/css/font-awesome.min.css" rel="stylesheet" />
    <script src="/Content/jquery/jquery.min.js"></script>
    <script src="/Content/jquery/jquery.md5.js"></script>
    <script src="/Content/layui/layui.js"></script>
    <script src="/Content/select2/js/select2.min.js"></script>
    <script src="/Content/framework/js/global.js"></script>
</head>
<body>
    <form id="form" class="layui-form" style="margin-top: 25px">

        @foreach (var item in ViewBag.list)
        {
            <div class="layui-form-item">
                <label class="layui-form-label" style="width:200px">@item.Name</label>
                <div class="layui-input-inline" style="width:500px">
                    <input type="text" name="@item.Key" lay-verify="required" autocomplete="off" class="layui-input" value="@item.Value" />
                </div>
            </div>
        }
        @*<vt:foreach from="$list" item="item" index="i">
            <div class="layui-form-item">
            <label class="layui-form-label" style="width:200px">{$:item.Name}</label>
            <div class="layui-input-inline" style="width:400px">
            <input type="text" name="{$:item.Key}" lay-verify="required" placeholder="请输入{$:item.Name}" autocomplete="off" class="layui-input" value="{$:item.Value}">
            </div>
            </div>
            </vt:foreach>*@
        <div class="layui-form-item">
            <div class="layui-input-inline" style="margin-left:300px">
                <button id="btnSubmit" class="layui-btn" lay-submit lay-filter="save">保存</button>
            </div>
        </div>
    </form>

    <script>
        layui.config({
            base: parent._baseUrl
        }).use(['form'], function () {
            var form = layui.form;

            form.on('submit(save)', function (data) {
                $.ajax({
                    url: "/config",
                    data: data.field,
                    type: "post",
                    async: false,
                    dataType: "json",
                    success: function (data) {
                        $.layerMsg(data.message, data.state);
                    },
                    error: function (xhr, status, error) {
                        $.layerMsg(error, "error");
                    }
                });
                return false;
            });
        });
    </script>
</body>
</html>